<script type="text/javascript" src="__ADDONROOT__/static/jquery.mousewheel-3.0.6.pack.js"></script>

<script type="text/javascript" src="__ADDONROOT__/static/jquery.fancybox.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="__ADDONROOT__/static/jquery.fancybox.css?v=2.1.5" media="screen" />

<!-- Add Button helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="__ADDONROOT__/static/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
<script type="text/javascript" src="__ADDONROOT__/static/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>

<!-- Add Thumbnail helper (this is optional) -->
<link rel="stylesheet" type="text/css" href="__ADDONROOT__/static/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
<script type="text/javascript" src="__ADDONROOT__/static/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>

<!-- Add Media helper (this is optional) -->
<script type="text/javascript" src="__ADDONROOT__/static/helpers/jquery.fancybox-media.js?v=1.0.6"></script>

<script type="text/javascript">
jQuery(function(){
	var group = {$addons_config['group']} ? "rel = 'group'" : "";
	jQuery('{$addons_config['content']|default='.article-content'} img').each(function(){
		var src = jQuery(this).attr('src');
		if($(this).attr('data-original')) src=$(this).attr('data-original');
		var title="";
		if($(this).attr('title')) title=$(this).attr('title');
		if(title==undefined || !title){
			if($(this).attr('alt')) title=$(this).attr('alt');
		}
		if(title==undefined){
			title="";
		}
		jQuery(this).wrap("<a class='fancybox_che1988' title='"+title+"' "+group+" href='"+src+"' ></a>");
	});
	jQuery(".fancybox_che1988").fancybox({
		'openEffect'           :   "{$addons_config['openEffect']}",
		'closeEffect'          :   "{$addons_config['closeEffect']}",
		padding                :   {$addons_config['padding']|intval},
		'hideOnContentClick'     :   "{$addons_config['hideOnContentClick']}",
				nextClick : true,
			tpl: {
				error    : '<p class="fancybox-error">指定的内容无法打开。<br/>请稍后再试。</p>',
			},
				helpers : {
					title : {
						type : 'inside'
					},
					buttons	: {}
				},
				afterLoad : function() {
					this.title = '第 ' + (this.index + 1) + ' 张，共 ' + this.group.length + '张' + (this.title ? ' - ' + this.title : '');
				}

 	});
});
</script>